Update-Help -UICulture en-US -Force -Verbose

Get-UICulture | select -ExpandProperty Name

PSProvider

Get-Help FileSystem

Show-Command Get-Alias

Get-Alias | Get-Member

# -replace
"SERVER-DC2" -replace "DC","FILE"
"SERVER-DC2","SERVER-DC7" -replace "DC","FILE"

# -split
"one,two,three,four,five" -split ","

-split "one two three four five"  #default delimiter is a space

"one,two,three,four,five" -split ",",3


# -join
$names=Get-Service | select -ExpandProperty name
$names -join ","

# object type operators
"world" -is [string]

"55.2" -as [int]

# format operator
"Today is {0} and your name is {1}" -f (Get-Date),(Get-Content Env:\USERNAME)
"Today is {0} and your name is {1}" -f (Get-Date),($Env:USERNAME)

#&
$cmd="dir"
&$cmd

# $()
$service=Get-Service | select -First 1
$name=$service.name
"service name is $name"
"Service name is $service.name"
"Service name is $($service.name)"

#
Get-Process | select PSResources

Get-Process | sort -Property VM -Descending

Get-Process | sort PM -Descending | select -First 5
Get-Process | sort PM -Descending | select -Skip 3 -First 5 

#Measure-Command
Measure-Command {Get-Service}
Measure-Command {1..5000 | select -First 5 -Wait}
Measure-Command {1..5000 | select -First 5 }

# Select-Object
Get-Process | Select -Property Name,ID,@{name="TotalMemory";expression={$_.PM+$_.VM}}
Get-Process | Select -Property Name,ID, @{name="VirtMem";expression={$PSItem.vm}},@{name="PhysMem";expression={$PSItem.pm}}

# expandProperty
$svc=Get-Service spooler | select DisplayName
Write-Host "Checking $($svc.DisplayName)"

$svc2=Get-Service spooler | select -ExpandProperty DisplayName
Write-Host "Checking $svc2"

Get-EventLog System -Newest 10 | select -unique -ExpandProperty Source

Get-Service -Name w3svc | select -ExpandProperty DependentServices

Get-Service  | where status -NE running
Get-Service | Get-Member


[System.ServiceProcess.ServiceControllerStatus] | Get-Member

Get-Command -Verb Get | Measure-Object

$service=Get-WmiObject win32_service | group StartMode -AsHashTable
$service

Get-Process | select name,id,vm,pm | ConvertTo-Csv >procs.csv
Get-Process | select name,id,vm,pm | ConvertTo-Csv Out-File procs.csv
Get-Process | select name,id,vm,pm | Export-Csv procs.csv

Get-Content .\procs.csv | select -First 2

Import-Csv .\procs.csv

Import-Csv .\procs.csv | where {$_.name -eq "YoudaoIE"}

Get-Service | where {$_.Status -eq "Stopped"} | ConvertTo-Html -Property Name,Status,DisplayName | Out-File stopped.html

#Compare-Object
Get-Process | Export-Clixml proc-baseline.xml
Get-Content .\proc-baseline.xml
Compare-Object -ReferenceObject (Import-Clixml .\proc-baseline.xml)  -DifferenceObject (Get-Process) -Property Name

#Formatting
Get-WmiObject Win32_OperatingSystem



